<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2019/9/11
 * Time: 9:51
 */

namespace app\home\controller;


class Coach extends Base
{
    private $user = false;

    public function _initialize(){
        parent::_initialize();
        $this->user = $this->user();
    }

    //教练列表
    public function index(){
        if (!$this->user) $this->redirect('User/login');
        $list = M('coachs')->order('sort')->select();
        $this->assign('list',$list);
        $this->assign('title','教练、顾问列表');
        return $this->fetch();
    }

    //教练详情
    public function detail(){
        if (!$this->user) $this->redirect('User/login');
        $coach_id = I('param.itemid');
        $detail = M('coachs')->where(array('coach_id' => $coach_id))->find();

        $this->assign('detail',$detail);
        $this->assign('title','教练、顾问详情');
        return $this->fetch();
    }

    //评论教练
    public function review(){
        if (!$this->user) $this->redirect('User/login');
        $this->assign('title','教练、顾问评论');
        return $this->fetch();
    }


}